package jay.home.bet.web.struts;

import java.util.Date;
import java.util.Properties;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jay.home.bet.misc.Util;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

public class DepositAction extends BaseAction
{
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception
			{
		DynaActionForm df = (DynaActionForm) form;
		String money = df.getString("money");
		String currencyType = df.getString("currencyType");
		
		String username = request.getRemoteUser();
		String billno = Util.uuid2();
		
		Properties prop = new Properties();
		prop.load(getClass().getClassLoader().getResourceAsStream("ips.properties"));
		String signature = prop.getProperty("signature");
		String merchantCode = prop.getProperty("merchantCode");
		
		request.setAttribute("money", money);
		request.setAttribute("currencyType", currencyType);
		request.setAttribute("username", username);
		request.setAttribute("billno", billno);
		request.setAttribute("signature", signature);
		request.setAttribute("datetime", Util.shortDate(new Date()));
		request.setAttribute("merchantCode", merchantCode);
		
		return mapping.findForward("SUCCESS");
			}
}
